﻿<Window x:Class="ActorFramework.Fakebook.UserHomePage"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="UserHomePage" Height="584.875" Width="663">
    <Grid>
        <!-- Using a button instead of an image for the profile picture, so we can click on it and display the profile picture in a separate window. -->
        <Button x:Name="ProfilePicture" HorizontalAlignment="Left" Height="200" Width="200" Margin="10,10,0,0" VerticalAlignment="Top" Background="White" Click="ProfilePicture_Click"/>
        
        <TextBlock x:Name="PersonNameTextBlock" HorizontalAlignment="Left" Height="35" Margin="220,31,0,0" TextWrapping="Wrap" Text="Person Name Here" VerticalAlignment="Top" Width="257" FontWeight="Bold" FontSize="20"/>
        <TextBlock x:Name="ProfileInfoTextBlock" Height="48" Margin="220,84,215,0" TextWrapping="Wrap" Text="Loading profile data..." VerticalAlignment="Top"/>
        <Button x:Name="FriendButton" Content="Add Friend" Margin="0,74,72,0" VerticalAlignment="Top" Height="36" Click="FriendButton_Click" HorizontalAlignment="Right" Width="119"/>

        <!-- Note: The Friends list is data bound to an IList<FakebookPerson> that also implements INotifyCollectionChanged.
             So the Grid below is pulling data out of a FakebookPerson instance. -->        
        <ListBox x:Name="FriendsListBox" HorizontalAlignment="Left" Margin="10,215,0,10" Width="200" >
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition />
                            <ColumnDefinition />
                        </Grid.ColumnDefinitions>
                        <Image Source="{Binding Path=ProfilePicture.ImageBytes}" Height="80" Width="80" Stretch="Uniform" />
                        <TextBlock Grid.Column="1" VerticalAlignment="Center" Text="{Binding Path=FullName}" />
                    </Grid>
                </DataTemplate>
            </ListBox.ItemTemplate>
            <ListBox.ContextMenu>
                <ContextMenu>
                    <MenuItem Header="View" Click="ViewFriend_Click" />
                    <MenuItem Header="Send Private Message" Click="SendPrivateMessage_Click"/>
                    <!--<MenuItem Header="Chat" />-->
                    <MenuItem Name="UnfriendContextMenuItem" Header="Unfriend" Click="Unfriend_Click" />
                </ContextMenu>
            </ListBox.ContextMenu>
        </ListBox>
        
        <!-- The NewsFeed list box is data bound to a list of NewsFeedUIItems.  We use an Rx-style observer to 
             received publish/subscribe style messages from the NewsFeed actor and add new items to this list.  -->
        <ListBox x:Name="NewsFeedListBox" Margin="220,285,10,10">
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <Grid>                        
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition />
                            <ColumnDefinition />
                        </Grid.ColumnDefinitions>
                        <Image Source="{Binding Path=AuthorPicture}" Height="50" Width="50" Stretch="Uniform" />
                        <TextBlock Grid.Column="1" VerticalAlignment="Top" Text="{Binding Path=AuthorFullName}" FontWeight="Bold" />
                        <TextBlock Grid.Column="1" VerticalAlignment="Center" Text="{Binding Path=Message}" />
                    </Grid>
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>
        
        <!-- This isn't using data binding yet.  Instead, we replace the contents with Buttons made from PictureInfos that
             we enumerate from our CloudStringDictionary<PictureInfo>.  -->
        <StackPanel x:Name="PhotosStackPanel" Orientation="Horizontal" Height="68" Margin="220,142,10,0" VerticalAlignment="Top">
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition />
                    <ColumnDefinition />
                </Grid.ColumnDefinitions>
                <!-- Normally you would just add images here, but we're going to add a Button instead so this is clickable.-->
                <Button Content="{Binding Path=ImageBytes}" Height="68" Width="68" Background="White" />
                <TextBlock Grid.Column="1" VerticalAlignment="Center" Text="  " />
            </Grid>
        </StackPanel>
        <!--
          Hmm.  No orientation.  Can't make it go side by side.  Yet, a StackPanel isn't clickable.
        <ListBox x:Name="PhotosListBox" Height="68" Margin="220,142,10,0" VerticalAlignment="Top">
            <StackPanel x:Name="PhotosStackPanel" Height="58" Width="410"/>            
        </ListBox>
        -->
        
        <TextBox x:Name="SearchTextBox" Height="21" Margin="0,10,49,0" TextWrapping="Wrap" Text="Search" VerticalAlignment="Top" HorizontalAlignment="Right" Width="147" />
        <Button x:Name="GoButton" Content="Go" Height="20" Margin="0,10,10,0" VerticalAlignment="Top" Click="SearchButton_Click" HorizontalAlignment="Right" Width="34"/>
        <Button Name="RefreshButton" Content="Refresh" Height="36" Margin="0,74,10,0" VerticalAlignment="Top" Click="RefreshButton_Click" HorizontalAlignment="Right" Width="57"/>

        <TextBlock Name="NewsfeedLabel" HorizontalAlignment="Left" Height="22" Margin="220,226,0,0" TextWrapping="Wrap" Text="What's up?" VerticalAlignment="Top" Width="70"/>
        <TextBox Name="NewsPostTextBox" Height="65" Margin="290,215,49,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" AcceptsReturn="True"/>
        <Button Name="NewsPostButton" Content="Post" HorizontalAlignment="Right" Height="29" Margin="0,237,10,0" VerticalAlignment="Top" Width="34" Click="NewsPostButton_Click"/>
    </Grid>
</Window>
